package com.longtop.db;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.longtop.dbHelper.IDbHelper;
import com.longtop.sp.mapdao.util.LoadConfigFile;

public class ImportDatas {
	
	public static void main(String[] args) {
		try{
			
			if(args.length < 1){
				System.out.println("请输入要导入的文件路径");
			}
			ApplicationContext appContext = new ClassPathXmlApplicationContext("applicationContext.xml");
			IDbHelper db  = (IDbHelper) appContext.getBean("dbHelper");
			LoadConfigFile cg = LoadConfigFile.getInstance("jdbc.properties");
			String db_type = (String) cg.getValue("jdbc.db_type");//将要操作的数据库类型
			//args[0]-->存放查询数据库的sql语句的xml文件，db_type-->要操作的数据库
			db.insertData(args[0],db_type);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
